package org.zfes.snowier.cloud.zbss.cms.router.service.content;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.content.model.CmsContentOperateRecord;
import org.zfes.snowier.cloud.zbss.cms.content.service.ICmsContentOperateRecordService;
@Controller("org.zfes.snowier.cloud.zbss.cms.router.service.content.CmsContentOperateRecordController") 
@RequestMapping("/cms/service/content/cmsContentOperateRecord")
public class CmsContentOperateRecordController extends BaseController {

	
	@Autowired
	private ICmsContentOperateRecordService cmsContentOperateRecordService;
	
	@RequiresPermissions(value="cmsContentOperateRecord:loadCmsContentOperateRecordDataSet",desc="内容后台操作记录列表")
    @RequestMapping(value="/loadCmsContentOperateRecordDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentOperateRecordDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsContentOperateRecordService.loadCmsContentOperateRecordDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsContentOperateRecord:createCmsContentOperateRecord",desc="内容后台操作记录添加")
    @RequestMapping(value="/createCmsContentOperateRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsContentOperateRecord(CmsContentOperateRecord cmsContentOperateRecord){
		cmsContentOperateRecordService.createCmsContentOperateRecord(cmsContentOperateRecord);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentOperateRecord:loadCmsContentOperateRecord",desc="内容后台操作记录加载")
    @RequestMapping(value="/loadCmsContentOperateRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentOperateRecord(Long id){
		Optional<CmsContentOperateRecord> ops = cmsContentOperateRecordService.loadCmsContentOperateRecordById(id);
		return ajaxQuery("cmsContentOperateRecord",ops);
    }
	
	@RequiresPermissions(value="cmsContentOperateRecord:updateCmsContentOperateRecord",desc="内容后台操作记录更新")
    @RequestMapping(value="/updateCmsContentOperateRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsContentOperateRecord(CmsContentOperateRecord cmsContentOperateRecord){
		cmsContentOperateRecordService.updateCmsContentOperateRecord(cmsContentOperateRecord);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentOperateRecord:deletCmsContentOperateRecord",desc="内容后台操作记录删除")
    @RequestMapping(value="/deleteCmsContentOperateRecord", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsContentOperateRecord(Long id){
		cmsContentOperateRecordService.deleteCmsContentOperateRecord(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}